<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.16"></script>
    <script src="https://unpkg.com/axios@1.6.8/dist/axios.min.js"></script>
</head>
<body>
    <div id="app">
    
        <button @click="lode">按钮</button>
        <br>名字：{{name}}<br>
        性别：{{sex}}
    </div>
    <script>
        var vm = new Vue({
            el:'#app',
            data:{
                name:"",
                sex:""

            },
            methods:{
                lode:function(){
                    axios.get("a.txt").then(function(res){
                        console.log(res.data.name);
                        vm.name=res.data.name
                        vm.sex=res.data.sex
                    })
                }
            }
        })
    </script>
</body>
</html>